clear all 
set more off 

	** Specify path to main replication folder 
	global path "XXX"

	** Subfolders
	global TAB "$path/Outputs/Tables"
	global int "${path}/Data/Intermediate"

	** Set folder for tables
	cd "${TAB}"

	** Commands to install
	/* 
	ssc install scheme-modern, replace
	ssc install ftools, replace 
	ssc install reghdfe, replace 
	ssc install parmest, replace
	ssc install outreg2, replace
	ssc install winsor2, replace
	ssc install boottest, replace
	ssc install wbopendata, replace
	ssc install kountry, replace
	*/

****************************************************************************
****************************************************************************
** MAIN PAPER
****************************************************************************
****************************************************************************

************
** Table 1: Educational attainment and labor market outcomes
************
{
	use "${int}/censo1992.dta",clear

	local out outreg2 using "Table_Paper_1", tex(frag) keep(a21_yr a21_yr_post) bdec(3) sdec(4) nocons

	reghdfe any_media_4p a21_yr a21_yr_post, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Sample, full) replace

	reghdfe any_college a21_yr a21_yr_post, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Sample, full)

	reghdfe any_college a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Sample, media 4+)

	reghdfe lfp a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Sample, media 4+)

	reghdfe Docc2 a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Sample, media 4+)

	reghdfe median_wage_9200_3 a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Sample, media 4+)

	reghdfe unemployed	 a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Sample, media 4+)

	use "${int}/casen_all.dta", clear

	reghdfe ytotalaj_r_w a21_yr a21_yr_post i.year if any_media_4p ==1, a(id_comuna_female) cl(comuna)
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes, Sample, media 4+) 
}

************
** Table 2: Household Wealth and Income
************
{
	use "${int}/censo1992.dta",clear
	
	local out outreg2 using "Table_Paper_2", tex(frag) keep(a21_yr a21_yr_post) bdec(3) sdec(4) nocons

	reghdfe Dqui5 a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes) replace

	reghdfe Dqui2_4 a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes) 

	reghdfe Dqui1 a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes) 

	use "${int}/casen_all.dta", clear

	reghdfe Dqaut_5 a21_yr a21_yr_post i.year if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 	

	reghdfe Dqaut_2_4 a21_yr a21_yr_post i.year if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 	

	reghdfe Dqaut_1 a21_yr a21_yr_post i.year if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 		
}

************
** Table 3: Opposition to Pinochet in 1988 Plebiscite
************
{
	use "${int}/Data_Plebiscite.dta", clear

	local out outreg2 using "Table_Paper_3.tex", bdec(2) sdec(2) nocons
	local demographic Pop70 sh_rural_70 sh_women_70
	local geographic DistStgo DistRegCapital DistProvCapital

	reg VoteShareNo estimate1_adj_std if sample==1, vce(robust)
	sum `e(depvar)' if e(sample) == 1
	local m = `r(mean)'
	boottest estimate1_adj_std, boottype(wild) reps(100) seed(1110) nograph 
	`out' addstat(Mean DV, `m', Bootstrap p-value, `r(p)') addtext(Population controls, No, Geographic controls, No, Region FE, No) replace
	reg VoteShareNo estimate1_adj_std `demographic' if sample==1, vce(robust)
	sum `e(depvar)' if e(sample) == 1
	local m = `r(mean)'
	boottest estimate1_adj_std, boottype(wild) reps(100) seed(1110) nograph 
	`out' addstat(Mean DV, `m', Bootstrap p-value, `r(p)') addtext(Population controls, Yes, Geographic controls, No, Region FE, No) 
	reg VoteShareNo estimate1_adj_std `demographic' `geographic' if sample==1, vce(robust)
	sum `e(depvar)' if e(sample) == 1
	local m = `r(mean)'
	boottest estimate1_adj_std, boottype(wild) reps(100) seed(1110) nograph 
	`out' addstat(Mean DV, `m', Bootstrap p-value, `r(p)') addtext(Population controls, Yes, Geographic controls, Yes, Region FE, No) 
	reg VoteShareNo estimate1_adj_std `demographic' `geographic' i.reg if sample==1, vce(robust)
	sum `e(depvar)' if e(sample) == 1
	local m = `r(mean)'
	boottest estimate1_adj_std, boottype(wild) reps(100) seed(1110) nograph 
	`out' addstat(Mean DV, `m', Bootstrap p-value, `r(p)') keep(estimate1_adj_std `demographic' `geographic') addtext(Population controls, Yes, Geographic controls, Yes, Region FE, Yes) 
	reg VoteShareNo estimate1_adj_std `demographic' `geographic' i.reg share_allende70_v2 if sample==1, vce(robust)
	sum `e(depvar)' if e(sample) == 1
	local m = `r(mean)'
	boottest estimate1_adj_std, boottype(wild) reps(100) seed(1110) nograph 
	`out' addstat(Mean DV, `m', Bootstrap p-value, `r(p)') keep(estimate1_adj_std `demographic' `geographic' share_allende70_v2) addtext(Population controls, Yes, Geographic controls, Yes, Region FE, Yes) tex(frag)	
}




****************************************************************************
****************************************************************************
** ONLINE APPENDIX
****************************************************************************
****************************************************************************


************
** Table A.1: Tertiary Enrollment and Democracy
************
{	
	use "${int}/wdi_fh.dta",clear

	local out outreg2 using "Table_Appendix_1.tex", keep(fiw ln_gdp_pc) dec(2) nocons

	reghdfe se_ter_enrr fiw if ln_gdp_pc!=., absorb(decade) cluster(countrycode)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)') addtext(Decade, Pooled) replace
	reghdfe se_ter_enrr fiw ln_gdp_pc, absorb(decade) cluster(countrycode)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)') addtext(Decade, Pooled)

	forvalues x=1970(10)2010{
		reg se_ter_enrr fiw if decade==`x'&ln_gdp_pc!=.,robust
		sum `e(depvar)' if e(sample)				
		`out' addstat(Mean DV, `r(mean)') addtext(Decade, `x')
		if `x'==2010 local replace tex(frag)
		reg se_ter_enrr fiw ln_gdp_pc if decade==`x',robust
		sum `e(depvar)' if e(sample)				
		`out' addstat(Mean DV, `r(mean)') addtext(Decade, `x') `replace'
	}
}

************
** Table A.2: College enrollment: Other sources
************
{
	use "${int}/casen_all.dta", clear

	local out outreg2 using "Table_Appendix_2.tex", keep(a21_yr a21_yr_post) bdec(3) sdec(4) nocons

	reghdfe any_college a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, No, Sample, CASEN) replace

	reghdfe any_college a21_yr a21_yr_post i.year if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, Yes, Sample, CASEN)

	use "${int}/censo2002.dta",clear

	reghdfe any_college a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, No, Sample, Census 2002)
	
	use "${int}/censo2017.dta",clear

	reghdfe any_college a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, No, Sample, Census 2017) tex(frag)
}

************
** Table A.3: College enrollment: Within-household estimates
************
{
	use "${int}/censo1992.dta",clear
		
	local out outreg2 using "Table_Appendix_3.tex", keep(a21_yr a21_yr_post) bdec(3) sdec(4) nocons
	
	reghdfe any_college a21_yr a21_yr_post i.id_comuna_female if any_media_4p==1&hijo==1, a(hh_id) cl(comuna_nac)		
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Household FE, Yes, year, 1992) ctitle(children) replace

	reghdfe any_college a21_yr a21_yr_post i.id_comuna_female if any_media_4p==1&(jefe==1|hermano==1), a(hh_id) cl(comuna_nac) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Household FE, Yes, year, 1992) ctitle(siblings)

	use "${int}/censo2002.dta",clear
		
	reghdfe any_college a21_yr a21_yr_post i.id_comuna_female if any_media_4p==1&hijo==1, a(hh_id) cl(comuna_nac)		
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Household FE, Yes, year, 2002) ctitle(children) 

	reghdfe any_college a21_yr a21_yr_post i.id_comuna_female if any_media_4p==1&(jefe==1|hermano==1), a(hh_id) cl(comuna_nac) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Household FE, Yes, year, 2002) ctitle(siblings)

	use "${int}/censo2017.dta",clear
		
	reghdfe any_college a21_yr a21_yr_post i.id_comuna_female if any_media_4p==1&hijo==1, a(hh_id) cl(comuna_nac)		
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Household FE, Yes, year, 2017) ctitle(children) 

	reghdfe any_college a21_yr a21_yr_post i.id_comuna_female if any_media_4p==1&(jefe==1|hermano==1), a(hh_id) cl(comuna_nac)
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Household FE, Yes, year, 2017) ctitle(siblings)	
}

************
** Table A.4: Occupational choice: Disaggregated categories
************
{
	use "${int}/censo1992.dta",clear

	foreach x of numlist 1 2 3 4 5 6 7 8 9 11 {

		if "`x'"=="1"{
			local end replace
		}
		
		else if "`x'"=="11"{
			local end tex(frag)
		}
		
		else{
			local end //
		}

		local out outreg2 using "Table_Appendix_4.tex", keep(a21_yr a21_yr_post) nocons bdec(3) sdec(4)

		reghdfe Docc`x' a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
		boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
		local p1: di %4.3fc r(p)
		boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
		local p2: di %4.3fc r(p)
		sum `e(depvar)' if e(sample)				
		`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes) `end'
	}	
}

************
** Table A.5: Countries and samples in synthetic control analysis
************
{
	** Constructed by hand
}

************
** Table A.6: Educational attainment and labor market outcomes: Excluding 1970-72 cohorts
************
{
	use "${int}/censo1992.dta",clear

	drop if age_21 >= 1970 & age_21 <= 1972

	local out outreg2 using "Table_Appendix_6", tex(frag) keep(a21_yr a21_yr_post) bdec(3) sdec(4) nocons

	reghdfe any_college a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes)

	reghdfe lfp a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes)

	reghdfe Docc2 a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean of dep. var, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes)

	reghdfe unemployed	 a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean of dep. var, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes)

	use "${int}/casen_all.dta", clear

	drop if age_21 >= 1970 & age_21 <= 1972

	reghdfe ytotalaj_r_w a21_yr a21_yr_post i.year if any_media_4p ==1, a(id_comuna_female) cl(comuna) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 	
}

************
** Table A.7: Household wealth and income: Excluding 1970-72 cohorts
************
{
	use "${int}/censo1992.dta",clear
	
	drop if age_21 >= 1970 & age_21 <= 1972

	local out outreg2 using "Table_Appendix_7", tex(frag) keep(a21_yr a21_yr_post) bdec(3) sdec(4) nocons

	reghdfe Dqui5 a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes) replace

	reghdfe Dqui2_4 a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes) 

	reghdfe Dqui1 a21_yr a21_yr_post if any_media_4p ==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes) 

	use "${int}/casen_all.dta", clear
	
	drop if age_21 >= 1970 & age_21 <= 1972

	reghdfe Dqaut_5 a21_yr a21_yr_post i.year if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 	

	reghdfe Dqaut_2_4 a21_yr a21_yr_post i.year if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 	

	reghdfe Dqaut_1 a21_yr a21_yr_post i.year if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 		
}

************
** Table A.8: Labor market outcomes with age fixed effects: CASEN
************
{
	use "${int}/casen_all.dta", clear
	
	local out outreg2 using "Table_Appendix_8", tex(frag) keep(a21_yr a21_yr_post) bdec(3) sdec(4) nocons

	reghdfe lfp a21_yr_post i.year i.edad if any_media_4p ==1, a(id_comuna_female) cl(comuna)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean of dep. var, `r(mean)', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes, Age FE, Yes) replace

	reghdfe unemployed a21_yr_post i.year i.edad if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean of dep. var, `r(mean)', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes, Age FE, Yes) 

	reghdfe ytotalaj_r_w a21_yr_post i.year i.edad if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean of dep. var, `r(mean)', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes, Age FE, Yes) 

	reghdfe Dqaut_5 a21_yr_post i.year i.edad if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean of dep. var, `r(mean)', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes, Age FE, Yes) 	

	reghdfe Dqaut_2_4 a21_yr_post i.year i.edad if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean of dep. var, `r(mean)', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes, Age FE, Yes) 	

	reghdfe Dqaut_1 a21_yr_post i.year i.edad if any_media_4p ==1, a(id_comuna_female) cl(comuna) 
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean of dep. var, `r(mean)', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes, Age FE, Yes) 
}

************
** Table A.9: Labor market outcomes: Census 2002
************
{
	use "${int}/censo2002.dta",clear

	append using "${int}/censo1992.dta"
	
	drop id_comuna_female
	egen id_comuna_female = group(comuna_nac female)

	local out outreg2 using "Table_Appendix_9", tex(frag) keep(a21_yr a21_yr_post) bdec(3) sdec(4) nocons

	reghdfe lfp a21_yr a21_yr_post if any_media_4p==1&year==2002, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, No, Age FE, No, Census, 2002) replace

	reghdfe lfp a21_yr a21_yr_post i.year if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, Yes, Age FE, No, Census, 1992 and 2002)

	reghdfe lfp a21_yr_post i.year i.edad if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, No, Age FE, Yes, Census, 1992 and 2002)

	reghdfe unemployed a21_yr a21_yr_post if any_media_4p==1&year==2002, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, No, Age FE, No, Census, 2002)

	reghdfe unemployed a21_yr a21_yr_post i.year if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, Yes, Age FE, No, Census, 1992 and 2002)

	reghdfe unemployed a21_yr_post i.year i.edad if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, No, Age FE, Yes, Census, 1992 and 2002)

	reghdfe Docc2 a21_yr a21_yr_post if any_media_4p==1&year==2002, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, No, Age FE, No, Census, 2002)

	reghdfe Docc2 a21_yr a21_yr_post i.year if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, Yes, Age FE, No, Census, 1992 and 2002)

	reghdfe Docc2 a21_yr_post i.year i.edad if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Year FE, No, Age FE, Yes, Census, 1992 and 2002)

}

************
** Table A.10: Educational attainment and labor market outcomes: Macro controls
************
{
	use "${int}/censo1992.dta",clear

	merge m:1 age_21 using "${int}/macro.dta", nogen

	local out outreg2 using "Table_Appendix_10.tex", keep(a21_yr a21_yr_post gdp_pc_gr gvt youth_u public) bdec(3) sdec(4) nocons

	reghdfe any_college a21_yr a21_yr_post gdp_pc_gr gvt youth_u public if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, No) replace

	reghdfe lfp a21_yr a21_yr_post gdp_pc_gr gvt youth_u public if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, No)

	reghdfe Docc2 a21_yr a21_yr_post gdp_pc_gr gvt youth_u public if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, No)

	reghdfe unemployed a21_yr a21_yr_post gdp_pc_gr gvt youth_u public if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, No)

	use "${int}/casen_all.dta", clear

	merge m:1 age_21 using "${int}/macro.dta", nogen

	reghdfe ytotalaj_r_w a21_yr a21_yr_post gdp_pc_gr gvt youth_u public i.year if any_media_4p==1, a(id_comuna_female) cl(comuna) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes)
}

************
** Table A.11: Household wealth and income: Macro controls
************
{
	use "${int}/censo1992.dta",clear

	merge m:1 age_21 using "${int}/macro.dta", nogen

	local out outreg2 using "Table_Appendix_11.tex", keep(a21_yr a21_yr_post gdp_pc_gr gvt youth_u public) bdec(3) sdec(4) nocons

	reghdfe Dqui5 a21_yr a21_yr_post gdp_pc_gr gvt youth_u public if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, No) replace

	reghdfe Dqui2_4 a21_yr a21_yr_post gdp_pc_gr gvt youth_u public if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, No)

	reghdfe Dqui1 a21_yr a21_yr_post gdp_pc_gr gvt youth_u public if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, No)

	use "${int}/casen_all.dta", clear

	merge m:1 age_21 using "${int}/macro.dta", nogen

	reghdfe Dqaut_5 a21_yr a21_yr_post gdp_pc_gr gvt youth_u public i.year if any_media_4p==1, a(id_comuna_female) cl(comuna) nocons 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 

	reghdfe Dqaut_2_4 a21_yr a21_yr_post gdp_pc_gr gvt youth_u public i.year if any_media_4p==1, a(id_comuna_female) cl(comuna) nocons 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes)

	reghdfe Dqaut_1 a21_yr a21_yr_post gdp_pc_gr gvt youth_u public i.year if any_media_4p==1, a(id_comuna_female) cl(comuna) nocons 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) tex(frag)
}

************
** Table A.12: Educational attainment and labor market outcomes: Effects by gender
************
{
	use "${int}/censo1992.dta",clear
	
	local out outreg2 using "Table_Appendix_12", tex(frag) keep(a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f) bdec(3) sdec(4) nocons
	
	reghdfe any_college a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	boottest a21_yr_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p3: di %4.3fc r(p)
	boottest a21_yr_post_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p4: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)
	local mean: di %4.3fc r(mean)
	`out' addstat(Mean DV, `mean', WB pvalue a21, `p1', WB pvalue a21 Post, `p2', WB pvalue a21 f, `p3', WB pvalue a21 Post f, `p4') addtext(County x gender FE, Yes) replace

	reghdfe lfp a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	boottest a21_yr_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p3: di %4.3fc r(p)
	boottest a21_yr_post_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p4: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)
	local mean: di %4.3fc r(mean)
	`out' addstat(Mean DV, `mean', WB pvalue a21, `p1', WB pvalue a21 Post, `p2', WB pvalue a21 f, `p3', WB pvalue a21 Post f, `p4') addtext(County x gender FE, Yes)

	reghdfe Docc2 a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	boottest a21_yr_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p3: di %4.3fc r(p)
	boottest a21_yr_post_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p4: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)
	local mean: di %4.3fc r(mean)
	`out' addstat(Mean DV, `mean', WB pvalue a21, `p1', WB pvalue a21 Post, `p2', WB pvalue a21 f, `p3', WB pvalue a21 Post f, `p4') addtext(County x gender FE, Yes)

	reghdfe unemployed a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	boottest a21_yr_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p3: di %4.3fc r(p)
	boottest a21_yr_post_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p4: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)
	local mean: di %4.3fc r(mean)
	`out' addstat(Mean DV, `mean', WB pvalue a21, `p1', WB pvalue a21 Post, `p2', WB pvalue a21 f, `p3', WB pvalue a21 Post f, `p4') addtext(County x gender FE, Yes)

	use "${int}/casen_all.dta", clear

	reghdfe ytotalaj_r_w a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f i.year if any_media_4p==1, a(id_comuna_female) cl(comuna) nocons
	boottest a21_yr_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	boottest a21_yr_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p3: di %4.3fc r(p)
	boottest a21_yr_post_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p4: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)
	local mean: di %4.3fc r(mean)
	`out' addstat(Mean DV, `mean', WB pvalue a21, `p1', WB pvalue a21 Post, `p2', WB pvalue a21 f, `p3', WB pvalue a21 Post f, `p4') addtext(County x gender FE, Yes, Survey year FE, Yes)
}

************
** Table A.13: Household wealth and income: Heterogeneous effects by gender
************
{
	use "${int}/censo1992.dta",clear

	local out outreg2 using "Table_Appendix_13", tex(frag) keep(a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f) bdec(3) sdec(4) nocons

	reghdfe Dqui5 a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	boottest a21_yr_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p3: di %4.3fc r(p)
	boottest a21_yr_post_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p4: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)
	local mean: di %4.3fc r(mean)
	`out' addstat(Mean DV, `mean', WB pvalue a21, `p1', WB pvalue a21 Post, `p2', WB pvalue a21 f, `p3', WB pvalue a21 Post f, `p4') addtext(County x gender FE, Yes) replace

	reghdfe Dqui2_4 a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	boottest a21_yr_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p3: di %4.3fc r(p)
	boottest a21_yr_post_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p4: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)
	local mean: di %4.3fc r(mean)
	`out' addstat(Mean DV, `mean', WB pvalue a21, `p1', WB pvalue a21 Post, `p2', WB pvalue a21 f, `p3', WB pvalue a21 Post f, `p4') addtext(County x gender FE, Yes)

	reghdfe Dqui1 a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f if any_media_4p==1, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	boottest a21_yr_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p3: di %4.3fc r(p)
	boottest a21_yr_post_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p4: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)
	local mean: di %4.3fc r(mean)
	`out' addstat(Mean DV, `mean', WB pvalue a21, `p1', WB pvalue a21 Post, `p2', WB pvalue a21 f, `p3', WB pvalue a21 Post f, `p4') addtext(County x gender FE, Yes)

	use "${int}/casen_all.dta", clear

	reghdfe Dqaut_5 a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f i.year if any_media_4p==1, a(id_comuna_female) cl(comuna) nocons 
	boottest a21_yr_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	boottest a21_yr_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p3: di %4.3fc r(p)
	boottest a21_yr_post_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p4: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)
	local mean: di %4.3fc r(mean)
	`out' addstat(Mean DV, `mean', WB pvalue a21, `p1', WB pvalue a21 Post, `p2', WB pvalue a21 f, `p3', WB pvalue a21 Post f, `p4') addtext(County x gender FE, Yes, Survey year FE, Yes)

	reghdfe Dqaut_2_4 a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f i.year if any_media_4p==1, a(id_comuna_female) cl(comuna) nocons 
	boottest a21_yr_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	boottest a21_yr_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p3: di %4.3fc r(p)
	boottest a21_yr_post_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p4: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)
	local mean: di %4.3fc r(mean)
	`out' addstat(Mean DV, `mean', WB pvalue a21, `p1', WB pvalue a21 Post, `p2', WB pvalue a21 f, `p3', WB pvalue a21 Post f, `p4') addtext(County x gender FE, Yes, Survey year FE, Yes)

	reghdfe Dqaut_1 a21_yr_m a21_yr_post_m a21_yr_f a21_yr_post_f i.year if any_media_4p==1, a(id_comuna_female) cl(comuna) nocons 
	boottest a21_yr_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post_m, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	boottest a21_yr_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p3: di %4.3fc r(p)
	boottest a21_yr_post_f, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p4: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)
	local mean: di %4.3fc r(mean)
	`out' addstat(Mean DV, `mean', WB pvalue a21, `p1', WB pvalue a21 Post, `p2', WB pvalue a21 f, `p3', WB pvalue a21 Post f, `p4') addtext(County x gender FE, Yes, Survey year FE, Yes)
}

************
** Table A.14: Labor market outcomes: Unrestricted sample
************
{
	use "${int}/censo1992.dta",clear
	
	local out outreg2 using "Table_Appendix_14", tex(frag) keep(a21_yr a21_yr_post) bdec(3) sdec(4) nocons

	reghdfe any_college a21_yr a21_yr_post, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes) replace

	reghdfe lfp a21_yr a21_yr_post, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes)

	reghdfe Docc2 a21_yr a21_yr_post, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes)

	reghdfe median_wage_9200_3 a21_yr a21_yr_post, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes)

	reghdfe unemployed a21_yr a21_yr_post, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes)

	use "${int}/casen_all.dta", clear

	reghdfe ytotalaj_r_w a21_yr a21_yr_post i.year, a(id_comuna_female) cl(comuna)
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 
}

************
** Table A.15: Household wealth and income: Unrestricted sample
************
{
	use "${int}/censo1992.dta",clear

	local out outreg2 using "Table_Appendix_15", tex(frag) keep(a21_yr a21_yr_post) bdec(3) sdec(4) nocons

	reghdfe Dqui5 a21_yr a21_yr_post, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes) replace

	reghdfe Dqui2_4 a21_yr a21_yr_post, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes) 

	reghdfe Dqui1 a21_yr a21_yr_post, a(id_comuna_female) cl(comuna_nac) nocons
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes) 

	use "${int}/casen_all.dta", clear

	reghdfe Dqaut_5 a21_yr a21_yr_post i.year, a(id_comuna_female) cl(comuna) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 	

	reghdfe Dqaut_2_4 a21_yr a21_yr_post i.year, a(id_comuna_female) cl(comuna) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 	

	reghdfe Dqaut_1 a21_yr a21_yr_post i.year, a(id_comuna_female) cl(comuna) 
	boottest a21_yr, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p1: di %4.3fc r(p)
	boottest a21_yr_post, boottype(wild) small cluster(id_cluster_cohort) seed(11111001) nograph
	local p2: di %4.3fc r(p)
	sum `e(depvar)' if e(sample)				
	`out' addstat(Mean DV, `r(mean)', WB pvalue a21, `p1', WB pvalue a21 Post, `p2') addtext(County x gender FE, Yes, Survey year FE, Yes) 		
}



